const materialReceive = {
  state: {
    listData: {}, // 列表数据
    materialDetail: [], // 清单明细
    receiveData: [], // 收料功能
    materialReceive: [],
  },
  // 唯一拥有更改内存数据的接口，不可进行异步操作
  mutations: {
    // 收料数量的缺省值为发料数量
    SetMaterialReceive: (state, list) => {
      list.map(val => {
        if (val.deliverQuantity === undefined) {
          val.receiveQuantity = 0
          val.deliverQuantity = 0
        } else {
          val.receiveQuantity = val.deliverQuantity
        }
      })
      state.materialReceive = list
    }
  },
  // 与mutation通讯，ui层写入内存数据的接口，可异步操作
  actions: {}
}

export default materialReceive
